<template>
    <div class="table">
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item><i class="icon iconfont icon-jifen"></i> 查看新闻</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <el-form ref="form" :model="data" label-width="150px" @submit.native.prevent>
                <el-form-item label="新闻标题：">
                    <p v-html="data.title"></p>
                </el-form-item>
                <el-form-item label="新闻封面图：">
                    <p><img :src="data.img" style="width:360px;height:180px"/></p>
                </el-form-item>
                <el-form-item label="新闻简介：">
                    <p v-html="data.summary"></p>
                </el-form-item>
                <el-form-item label="新闻描述：">
                    <p v-html="data.detail"></p>
                </el-form-item>
            </el-form>
            
        </div>
        
    </div>
</template>
<script>
export default {
    name:'newsAdd',
    data (){
        return{
            data:{}
        }
    },
    mounted (){
        // console.log(this.$route.params.id);
        // console.log(this.$route.path);
        this.getNews();
    },
    methods:{
        getNews (){
            if(this.$route.params.id && this.$route.params.id ){
                this.$axios.get('/manage/news/find', {
                    params: {
                    id: this.$route.params.id
                    }
                })
                .then(response=>{
                    console.log(response);
                    if(response.data.code==200){
                        //获取数据
                        this.data = response.data.data;
                        //console.log(this.data);
                    }else{
                        this.$notify.error({
                            title: '查询失败',
                            duration:2000,
                            message: '失败原因：'+response.data.msg
                        });
                    }
                })
                .catch(function (response) {
                    console.log(response);
                });
            }else{
                this.$message.error('获取新闻ID失败');
            }
        }
    }
}
</script>
<style lang="stylus" scoped>
    
</style>


